<div class="grid_9">
<?if(isset($message))echo $message;?>
<?php if($this->session->flashdata('type')): ?>
	<div class="<?php echo $this->session->flashdata('type')?>"><?php echo $this->session->flashdata('msg')?></div>
<?php endif; ?>

<div class="inner-border">
<h6>School year</h6>
<?if(!empty($sy_data)):?>
<?
foreach($sy_data as $key => $value){
		
		if($value->current_year == 0){
			// data from school year that is not the current school year
			$not_current[$key] = $value;
		}else{
			//current school year
			$current[$key] = $value;
		}
}
?>
<div class="school_year">
	<?	//if current is empty,current school year not yet set
		if(!empty($current)):?>
		<?foreach($current as $current_sy):?>
			<?$current_sy_id = $current_sy->sy_id;?>
			<p class="title"><?=$current_sy->sy_title;?></p>
			<h1>current school year: <?=$current_sy->sy_year;?></h1>
			<p class="content"><?=$current_sy->sy_desc;?></p>
		<?endforeach;?>
		<a href="<?=site_url('admin/functions_schoolyear/update'.'/'.$current_sy_id);?>" class="btn">Edit</a>
	<?else:?>
		<div class="input-block">
			<div class="notice">School Year Not Set</data>
		</div>
	<?endif;?>
		
	</div>
	
	
		<div class="school_year">
			<?  // if not empty $not_current, there are other school year entries
				if(!empty($not_current)):?>
				<form action="<?=site_url('admin/update_schoolyear');?>" method="POST" class="admin-form">
				<p>Change Current School Year</p>
					<select name="sy_id">
							<option value=""></option>
						<?foreach($not_current as $available_menu):?>
							<option value="<?=$available_menu->sy_id;?>"><?=$available_menu->sy_year;?></option>
						<?endforeach;?>
					</select>
					
				<?	// sy_id of the current year
					if(isset($current_sy_id)):?>	
					<input type="hidden" name="current_sy_id" value="<?=$current_sy_id;?>">
				<?endif;?>
				<input type="submit" value="update school year">
				<?echo form_error('sy_id');?>
				</form>
			<?else:?>
					<p>Change Current School Year</p>
					<select name=""><option value="">No Data Available</option></select>
			<?endif;?>
		</div>
	
	
	 
<?else:?>
	<div class="input-block">
		<div class="notice">No Data to retrieve</data>
	</div>

<?endif;?>
		
<a href="<?php echo site_url('admin/functions_schoolyear/add') ?>" class="btn">Add School Year</a>
<a href="<?php echo site_url('admin/functions_schoolyear/del') ?>" class="btn">Del School Year</a>
</div>
</div>
</div>